package com.soup.lab.tools.faker.source;

import java.io.*;
import java.nio.charset.Charset;

public interface ReaderSource extends InputStreamSource {

    Charset getCharset();

    default BufferedReader getAsReader() throws IOException {
        InputStream inputStream = getAsInputStream();
        return inputStream == null ? null : new BufferedReader(new InputStreamReader(inputStream, getCharset()));
    }

}
